#include "SocketBase.h"
#include <errno.h>
#include <unistd.h>

SocketBase::SocketBase()
	: m_hSock(0)
{
}

SocketBase::~SocketBase()
{
	Close();
}

void SocketBase::SetHandler(int hSock)
{
	m_hSock = hSock;
}

int SocketBase::GetHandler()
{
	return m_hSock;
}

int SocketBase::Close()
{
	if(close(GetHandler()) != 0)
		return errno;
	else
	{
		SetHandler(0);
		return 0;
	}
}
